/*
 * Copyright � 2008 Nokia Corporation.
 */


#ifndef SudokuMenuControl_H
#define SudokuMenuControl_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <coecntrl.h>

// CLASS DECLARATION
class CSudokuContainerControl;
class CFbsBitGc;

const TInt KItemCap = 10;//4;
const TInt KHeightTuning = 20;//8;

class MSudokuMenuControlObserver
    {
    public:
        virtual void MenuItemSelected(TInt aIndex) = 0;
    };

class CSudokuMenuControl : public CCoeControl
    {
    public:
        ~CSudokuMenuControl ( );
        static CSudokuMenuControl* NewL (CSudokuContainerControl& aParent, CFbsBitGc*& aBgc);
        static CSudokuMenuControl* NewLC (CSudokuContainerControl& aParent, CFbsBitGc*& aBgc);
        
    private:
        CSudokuMenuControl (CSudokuContainerControl& aParent, CFbsBitGc*& aBgc);
        void ConstructL ();

    private:
        void Draw( const TRect& aRect ) const;
        void DrawItems() const;
        void SizeChanged();
        void HandlePointerEventL(const TPointerEvent& aPointerEvent);
    
    public:
        void MakeVisible(TBool aVisible);
        void SetObserver(MSudokuMenuControlObserver* aObserver);
        void AddMenuItemL(TDesC& aItem);
        TSize MiniSizeNeeded();    
        void HitActimeMenuItem();
        
        
    public:
        TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
        
    private:
        CFbsBitGc*&                 iBgc;
        CSudokuContainerControl&    iParent;
        CDesCArrayFlat*             iStringArray;
        MSudokuMenuControlObserver* iObserver;
        TInt                        iItemHeight;
        TInt                        iItemWidth;
        TInt                        iActiveItem;
        
    };

#endif // SudokuMenuControl_H
